package HelloSeries.ui.prefs.elems.flextables.editor;

import java.awt.Component;

import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JTable;

public class ComboBoxEditor extends DefaultCellEditor {
	protected JComboBox combobox;
	private Object    content;
	public ComboBoxEditor(Object[] items) {
		super(new JComboBox(items));
		combobox = new JComboBox(items);
	}
	
	public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
		combobox.setSelectedItem(value);
		content = (Object)combobox.getSelectedItem();
		return combobox;
	}


	public Object getCellEditorValue() {
		content = (Object)combobox.getSelectedItem();
		return content;
	}


	public boolean stopCellEditing() {
		content = (Object)combobox.getSelectedItem();
		return super.stopCellEditing();
	}

}
